﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PCS_Linh.lab02
{
    class xPowerN
    {
        public void run()
        {
            Console.Write("Please enter the value of x varilable: ");
            double x = Convert.ToDouble(Console.ReadLine());

            Console.Write("Please enter the value of n variable: ");
            int n = Convert.ToInt32(Console.ReadLine());

            int m = (n >= 0) ? n : -n;
            double s = 1;
            for (int i = 1; i <= m; i++)
            {
                s = s * x;
            }
            s = (n >= 0) ? s : (1 / s);
            Console.WriteLine("{0}^{1} = {2}", x, n, s);
        }
    }
}
